﻿<%@ Page Title="Report Details" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="View_Report.aspx.cs" Inherits="admin_View_Report" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
    <link href="../styles/admin.css" rel="stylesheet" type="text/css" />

    <script src="../javascripts/jquery-1.4.3.min.js" type="text/javascript"></script>

    <script src="../javascripts/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {
            $(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' });
        });  
    </script>

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <div id="top_menu">
        <div id="help_button">
            help
        </div>
    </div>
    <div id="page_title">
        ADMINISTRATION
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="left_content">
        <div class="menu">
            <ul>
                <li><a href="Home.aspx">Home</a></li>
                <li><a href="Mng_Client.aspx">Manage Clients</a></li>
                <li><a href="Mng_Site.aspx">Manage Sites</a></li>
                <li><a href="Mng_Machine.aspx">Manage Machines</a></li>
                <li><a href="Mng_Comp.aspx">Manage Components</a></li>
                <li><a href="#" class="current">View Report Details</a></li>
                <li><a href="Mng_WO.aspx">Manage Work Order</a></li>
                <li><a href="Mng_FaultsRecom.aspx">Manage Faults Recommendation</a></li>
            </ul>
        </div>
    </div>
    <!-- end of left content -->
    <div id="right_content">
        <div class="content_area">
            <h2>
                Report Details
            </h2>
            <div class="form_box1">
                <asp:FormView ID="FormViewReport" runat="server" DataKeyNames="component_id,dateRecorded"
                    DataSourceID="ComponentStatusObjectDataSource">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td class="label1">
                                    Component:
                                </td>
                                <td colspan="2">
                                    <asp:Label ID="component_idLabel1" runat="server" Text='<%# Eval("component_id") %>'
                                        CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Status:
                                </td>
                                <td colspan="2">
                                    <asp:DropDownList ID="StatusDropDownList" runat="server" AutoPostBack="True" DataSourceID="StatusObjectDataSource"
                                        DataTextField="statusName" DataValueField="status_id" SelectedValue='<%# Bind("status_id") %>'
                                        CssClass="dropDownList">
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="StatusObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                                        SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.StatusTableAdapter">
                                    </asp:ObjectDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Standard Comments:
                                </td>
                                <td colspan="2">
                                    <asp:DropDownList ID="commentDescriptionDropDownList" runat="server" AutoPostBack="true"
                                        DataSourceID="CommentsObjectDataSource" DataTextField="comment_id" DataValueField="comment_id"
                                        SelectedValue='<%# Bind("comment_id") %>' CssClass="dropDownList">
                                        <asp:ListItem Selected="True" Text="None">None</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:TextBox ID="commentDescriptionTextBox" runat="server" CssClass="fields1"></asp:TextBox>
                                    <asp:ObjectDataSource ID="CommentsObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                                        SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.StandardCommentsTableAdapter">
                                    </asp:ObjectDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td colspan="2">
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Additional Comments:
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="commentsTextBox" runat="server" Text='<%# Bind("comments") %>' CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Date Recorded:
                                </td>
                                <td colspan="2">
                                    <asp:Label ID="dateRecordedLabel1" runat="server" Text='<%# Eval("dateRecorded", "{0:d}") %>'
                                        CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Date Entered:
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="dateEnteredTextBox" runat="server" Text='<%# Bind("dateEntered", "{0:d}") %>'
                                        class="datepicker" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                                        Text="Update" />
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Cancel" />
                                </td>
                            </tr>
                        </table>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <table>
                            <tr>
                                <td class="label1">
                                    Component:
                                </td>
                                <td>
                                    <asp:Label ID="component_idLabel" runat="server" Text='<%# Eval("component_id") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Status:
                                </td>
                                <td>
                                    <asp:Label ID="status_idLabel" runat="server" Text='<%# Bind("status_id") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Standard Comments:
                                </td>
                                <td>
                                    <asp:Label ID="comment_idLabel" runat="server" Text='<%# Bind("comment_id") %>' ReadOnly="True"
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Additional Comments:
                                </td>
                                <td>
                                    <asp:Label ID="commentsLabel" runat="server" Text='<%# Bind("comments") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Date Recorded:
                                </td>
                                <td>
                                    <asp:Label ID="dateRecordedLabel" runat="server" Text='<%# Eval("dateRecorded", "{0:d}") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label1">
                                    Date Entered:
                                </td>
                                <td>
                                    <asp:Label ID="dateEnteredLabel" runat="server" Text='<%# Bind("dateEntered", "{0:d}") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                        Text="Edit" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:FormView>
                <asp:ObjectDataSource ID="ComponentStatusObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetDataByComponentIDandDateRecorded" TypeName="DataAccess.i2iPortalTableAdapters.ComponentStatusTableAdapter"
                    UpdateMethod="Update">
                    <UpdateParameters>
                        <asp:Parameter Name="status_id" Type="Int32" />
                        <asp:Parameter Name="comments" Type="String" />
                        <asp:Parameter Name="dateEntered" Type="DateTime" />
                        <asp:Parameter Name="comment_id" Type="Int32" />
                        <asp:Parameter Name="Original_component_id" Type="Int32" />
                        <asp:Parameter Name="Original_dateRecorded" Type="DateTime" />
                    </UpdateParameters>
                    <SelectParameters>
                        <asp:QueryStringParameter Name="component_id" QueryStringField="component_id" Type="Int32" />
                        <asp:QueryStringParameter Name="dateRecorded" QueryStringField="dateRecorded" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </div>
        </div>
        <div class="content_area2">
            <h2>
                Status Details
            </h2>
            <div class="form_box1">
                <asp:FormView ID="FormViewStatus" runat="server" AllowPaging="True" DataKeyNames="status_id"
                    DataSourceID="StatusObjectDataSource" PagerSettings-Mode="NextPrevious">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Status ID:
                                </td>
                                <td colspan="2">
                                    <asp:Label ID="status_idLabel1" runat="server" Text='<%# Eval("status_id") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status Name:
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="statusNameTextBox" runat="server" Text='<%# Bind("statusName") %>'
                                        CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Description:
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="statusDescriptionTextBox" runat="server" Text='<%# Bind("statusDescription") %>'
                                        CssClass="fields1" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                                        Text="Update" />
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Cancel" />
                                </td>
                            </tr>
                        </table>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Status ID:
                                </td>
                                <td>
                                    <asp:Label ID="status_idLabel1" runat="server" Text='<%# Eval("status_id") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status Name:
                                </td>
                                <td>
                                    <asp:Label ID="statusNameLabel" runat="server" Text='<%# Bind("statusName") %>' CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Description:
                                </td>
                                <td>
                                    <asp:Label ID="statusDescriptionTextBox" runat="server" Text='<%# Bind("statusDescription") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td class="Li_buttonC">
                                    <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                        Text="Edit" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:FormView>
                <asp:ObjectDataSource ID="StatusObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.StatusTableAdapter"
                    UpdateMethod="Update">
                    <UpdateParameters>
                        <asp:Parameter Name="statusName" Type="String" />
                        <asp:Parameter Name="statusDescription" Type="String" />
                        <asp:Parameter Name="Original_status_id" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
            </div>
        </div>
        <div class="content_area2">
            <h2>
                Available Standard Comments
            </h2>
            <div class="form_box">
                <asp:GridView ID="GridViewStandardComments" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    DataKeyNames="comment_id" DataSourceID="StdCommentsObjectDataSource" AllowSorting="True"
                    OnSelectedIndexChanged="GridViewStandardComments_SelectedIndexChanged">
                    <Columns>
                        <asp:BoundField DataField="statusName" HeaderText="Status Name" SortExpression="statusName">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:BoundField DataField="commentDescription" HeaderText="Comment Description" SortExpression="commentDescription">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:CommandField SelectText="Details..." ShowSelectButton="True">
                            <ItemStyle CssClass="column" />
                        </asp:CommandField>
                    </Columns>
                    <HeaderStyle CssClass="header" />
                </asp:GridView>
                <asp:ObjectDataSource ID="StdCommentsObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.CommentsOnStatusTableAdapter">
                </asp:ObjectDataSource>
                <br />
                <asp:Button ID="CreateStdCommentsButton" runat="server" Text="Add Standard Comments"
                    OnClick="CreateStdCommentsButton_Click" CssClass="buttons" />
            </div>
        </div>
        <asp:LinkButton ID="BackButton" runat="server" PostBackUrl="Mng_Report.aspx" CssClass="backbtn">Back</asp:LinkButton>
    </div>
    <!-- end of right content -->
</asp:Content>
